package eu.ricordo.reasoner.deamon;

import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonInitException;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by IntelliJ IDEA.
 *
 * @author Sarala Wimalaratne
 *         Date: 12-Aug-2011
 *         Time: 08:06:06
 */

public class App implements Daemon {

    private static KBCreator kbCreator = null;

    public static void main(String[] args) {
        kbCreator = new KBCreator();
        kbCreator.startPelletServer();
        kbCreator.setUpReasoner();
        kbCreator.createKB();
    }

    public void init(DaemonContext dc) throws DaemonInitException, Exception {
        System.out.println("initializing ...");
    }

    public void start() throws Exception {
        System.out.println("starting ...");
        main(null);

    }

    public void stop() throws Exception {
        System.out.println("stopping ...");

        if(kbCreator!=null){
            kbCreator.stopPelletServer();
        }
    }

    public void destroy() {
        System.out.println("done.");
    }

}